<template>
    <div class="main_box" style="padding:10px">
      <div class="add_wrap">
        <el-form label-width="200px">
          <div class="tit">
            <h2>基础信息</h2>
            <el-button type="success" plain size="small" icon="fa fa-mail-forward" @click="returnList">返回</el-button>
          </div>
          <el-row>
            <el-form-item label="头像:">
              <el-image fit="cover" :src="dataInfo.avatar" :preview-src-list="[dataInfo.avatar]"></el-image>
            </el-form-item>
            <el-form-item label="编号:">
              <span>{{ dataInfo.userCode}}</span>
            </el-form-item>
            <el-form-item label="登录账号:">
              <span>{{ dataInfo.userName}}</span>
            </el-form-item>
            <el-form-item label="昵称:">
              <span>{{ dataInfo.nickName }}</span>
            </el-form-item>
            <el-form-item label="手机号:">
              <span>{{ dataInfo.phone }}</span>
            </el-form-item>
            <el-form-item label="真实姓名:">
              <span>{{ dataInfo.fullName }}</span>
            </el-form-item>
            <!-- <el-form-item label="所属商户:">
              <span>{{ dataInfo.businessName}}</span>
            </el-form-item>
            <el-form-item label="所属业务员:">
              <span>{{ dataInfo.saleUserName}}</span>
            </el-form-item> -->
            <el-form-item label="性别:">
              <span>{{ dataInfo.sex == 1 ? "男" : "女" }}</span>
            </el-form-item>
            <el-form-item label="邮箱:">
              <span>{{ dataInfo.email }}</span>
            </el-form-item>

            <el-form-item label="信用:">
              <span>{{ dataInfo.credit }}</span>
            </el-form-item>
            <el-form-item label="简介:">
              <span>{{ dataInfo.userIntroduce }}</span>
            </el-form-item>
            <el-form-item label="状态:">
              <el-tag size="mini" effect="dark" :type="formatStates(dataInfo.state)">
								{{ formatState(dataInfo.state) }}
							</el-tag>
            </el-form-item>
            <el-form-item label="创建人:">
              <span>{{ dataInfo.createUserName }}</span>
            </el-form-item>
            <el-form-item label="创建时间:">
              <span>{{ dataInfo.createDate }}</span>
            </el-form-item>
            <el-form-item label="修改人:">
              <span>{{ dataInfo.modifyUserName }}</span>
            </el-form-item>
            <el-form-item label="修改时间:">
              <span>{{ dataInfo.modifyDate }}</span>
            </el-form-item>
          </el-row>
        </el-form>
      </div>
    </div>
  </template>

  <script>
  import CustomerApi from '@/api/customer/customer';
  export default {
    data() {
      return {
        dataInfo: {},
      };
    },
    computed: {},
    mounted() {
      this.getData()
    },
    methods: {
      getData() {
        CustomerApi.getCustomerInfo({ id: this.$route.query.id }).then(res => {
          this.dataInfo = res.data
        })
      },
      formatCustomerLevels(cellValue) {
        if (cellValue === 1) {
          return "普通用户";
        } else if (cellValue === 2) {
          return "推广员"
        } else if (cellValue === 3) {
          return "业务员"
        }
      },
      formatState(cellValue) {
        if (cellValue === 0) {
          return "禁用";
        } else if (cellValue === 1) {
          return "启用";
        }
      },
      formatStates(cellValue) {
        if (cellValue === 0) {
          return "warning";
        } else if (cellValue === 1) {
          return "success";
        }
      },
      returnList() {
        this.$store.dispatch('delView', this.$route);
        this.$router.back()
      }
    },

  }

  </script>
  <style lang="scss" scoped>
@import "@/assets/css/views/add.scss";
</style>
